<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head lang="en">
    <meta charset="UTF-8"/>
    <title>微分享-后台管理系统</title>
    <link rel="stylesheet" th:href="@{/static/assets/css/amazeui.min.css}"/>
    <link rel="stylesheet" th:href="@{/static/lib/layer/skin/layer.css}" />
    <link rel="shortcut icon" th:href="@{/static/img/favicon.ico}" />
    <!--dwr js  -->
<script type= "text/javascript" th:src ="@{/dwr/util.js}"></script>   
<script type="text/javascript" th:src= "@{/dwr/engine.js}"></script > 
<script type="text/javascript" th:src= "@{/dwr/interface/NoticeContentController.js}"></script>
<script type="text/javascript" th:src= "@{/static/js/dwrhelp.js}"></script>
    <style>
        .header {
            text-align: center;
        }

        .header h1 {
            font-size: 200%;
            color: #333;
            margin-top: 30px;
        }

        .header p {
            font-size: 14px;
        }
    </style>
    <script th:src="@{/static/assets/js/jquery.min.js}"></script>
    <script th:src="@{/static/js/public.js}"></script>
    <script>
    /*<![CDATA[*/
        function login() {
        	postReturnJson("/login",{
        		userName: $("#code").val(),
                password: $("#password").val()
            },function (msg) {
                if (msg.success) {
                	 window.sessionStorage.setItem("userId",msg.obj.id);
                     window.sessionStorage.setItem("loginUsername", msg.obj.name);
                     if(msg.obj.admin){
                    	window.location.href = 'admin_index';
                     } else {
                    	window.location.href = 'all_share';
                     }
                 } else {
                     $("#error_message").html(msg.msg);
                 }
             });
        }
        /*]]>*/
    </script>
</head>
<body>
	<div class="header">
	    <div class="am-g">
	        <h1>微分享-后台管理系统</h1>
	    </div>
	</div>
	<div class="am-g">
	    <div class="am-u-lg-6 am-u-md-8 am-u-sm-centered">
	        <form method="post" class="am-form">
	            <label>用户名:</label>
	            <input type="text" code="" id="code" value=""/>
	            <br></br>
	            <label for="password">密码:</label>
	            <input type="password" code="" id="password" value=""/>
	            <br></br>
	            <div class="am-cf">
	                <input onclick="login()" type="button" code="" value="登 录"
	                       class="am-btn am-btn-primary am-btn-sm am-fl"/>
	                <input onclick="window.location.href='normal_login'" type="button" code="" value="普通用户登录"
	                       class="am-btn am-btn-primary am-btn-sm am-fl"/>
	                <input onclick="window.location.href='normal_register'" type="button" code="" value="注册"
	                       class="am-btn am-btn-primary am-btn-sm am-fl"/>
	            </div>
	            <span id="error_message" style="color: red"></span>
	        </form>
	        <p>周航@成都信息工程大学, All Rights Reserved.</p>
	    </div>
	</div>
</body>
</html>
